#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void swap(int* a, int* b)
{
	int tem = *a;
	*a = *b;
	*b = tem;
}
void quicksort(int *a,int left ,int right)
{
	if (left >= right)
	{
		return;
	}
	int keyi = left;
	int begin = left;
	int end = right;
	while (begin < end)
	{
		while (begin < end && a[end] >= a[keyi])
		{
			end--;
		}
		while (begin < end && a[begin] <= a[keyi])
		{
			begin++;
		}
		swap(&a[end], &a[begin]);
	}
	swap(&a[keyi], &a[begin]);
	quicksort(a, left, begin - 1);
	quicksort(a, begin + 1, right);
}
int main()
{
	int a[] = { 4,24,53,34,36,3,312 };
	quicksort(a, 0, 6);
	for (int i = 0; i < 7; i++)
	{
		printf("%d ", a[i]);
	}
}